using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Utility;
using DTO;

namespace BUS
{
    public  class tbemailthongbaoBUS
    {
        public static tbemailthongbaocollection Get(string where,
       int pageindex,
       int pagesize,
       string orderby,
       string orderdirection,
       out int total)
        {
            tbemailthongbaoDAL emailthongbaoDAL = new tbemailthongbaoDAL();
            return emailthongbaoDAL .Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbemailthongbaocollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbemailthongbaoDAL emailthongbaoDAL = new tbemailthongbaoDAL();
            return emailthongbaoDAL.Get(cri.Criter, 0, 0, emailthongbaocolumns.mathongbao .ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbemailthongbao GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, emailthongbaocolumns.mathongbao .ToString(), Condition.EQUAL, iD);
            tbemailthongbaoDAL emailthongbaoDAL = new tbemailthongbaoDAL();
            tbemailthongbaocollection emailthongbaocollection = emailthongbaoDAL .Get(cri.Criter,
                     0, 0, emailthongbaocolumns.mathongbao.ToString(), OrderDirection.ASC.ToString(), out total);
            if (emailthongbaocollection .Count > 0)
                return emailthongbaocollection [0];
            return null;
        }
    }
}
